home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / langs / icon8_fx.zoo / diffs / iconx.dif < prev   
Encoding:
Text File  |  1991-02-18  |  21.0 KB  |  692 lines

  1. *** old\fmath.c
  2. --- fmath.c
  3. **************
  4. *** 26,27
  5.   #if LATTICE
  6.   #include <error.h>
  7. --- 26,30 -----
  8.   #if LATTICE
  9. + #ifdef __GNUC__
  10. + #include <errno.h>
  11. + #else
  12.   #include <error.h>
  13. **************
  14. *** 27,28
  15.   #include <error.h>
  16.   #else                    /* LATTICE */
  17. --- 30,32 -----
  18.   #include <error.h>
  19. + #endif
  20.   #else                    /* LATTICE */
  21. *** old\fsys.c
  22. --- fsys.c
  23. **************
  24. *** 427,428
  25.         mode[1] = '+';
  26.         mode[2] = untranslated ? 'b' : 'a';
  27. --- 427,431 -----
  28.         mode[1] = '+';
  29. + #ifdef __GNUC__
  30. +       mode[2] = untranslated ? 'b' : '\0';
  31. + #else
  32.         mode[2] = untranslated ? 'b' : 'a';
  33. **************
  34. *** 428,429
  35.         mode[2] = untranslated ? 'b' : 'a';
  36.         }
  37. --- 431,433 -----
  38.         mode[2] = untranslated ? 'b' : 'a';
  39. + #endif
  40.         }
  41. **************
  42. *** 429,430
  43.         }
  44.      else mode[1] = untranslated ? 'b' : 'a';
  45. --- 433,437 -----
  46.         }
  47. + #ifdef __GNUC__
  48. +    else mode[1] = untranslated ? 'b' : '\0';
  49. + #else
  50.      else mode[1] = untranslated ? 'b' : 'a';
  51. **************
  52. *** 430,431
  53.      else mode[1] = untranslated ? 'b' : 'a';
  54.   #endif                                  /* ATARI_ST */
  55. --- 437,439 -----
  56.      else mode[1] = untranslated ? 'b' : 'a';
  57. + #endif
  58.   #endif                                  /* ATARI_ST */
  59. *** old\getch.c
  60. --- getch.c
  61. **************
  62. *** 0,0
  63. --- 1,28 -----
  64. + #include <osbind.h>
  65. + int getch()
  66. + {
  67. +     int c;
  68. +     c =  Crawcin() & 0xFF;
  69. +     return(c);
  70. + }
  71. + int putch(c)
  72. + int c;
  73. + {
  74. +     Cconout(c);
  75. +     return(c);
  76. + }
  77. + int getche()
  78. + {
  79. +     int c;
  80. +     return (putch(c = getch()));
  81. + }
  82. + int kbhit()
  83. + {
  84. +     return(Cconis());
  85. + }
  86. *** old\imain.c
  87. --- imain.c
  88. **************
  89. *** 18,20
  90.   hidden    novalue    env_err    Params((char *msg,char *name,char *val));
  91.   /*
  92. --- 18,22 -----
  93.   hidden    novalue    env_err    Params((char *msg,char *name,char *val));
  94. ! #if ATARI_ST
  95. ! hidden  novalue ST_error Params((char *msg));
  96. ! #endif
  97.   /*
  98. **************
  99. *** 266,268
  100.   
  101. !    if (!argc) 
  102.         error("no icode file specified");
  103. --- 268,273 -----
  104.   
  105. !    if (!argc) {
  106. ! #if ATARI_ST
  107. !       ST_error("no icode file specified");
  108. ! #else
  109.         error("no icode file specified");
  110. **************
  111. *** 268,269
  112.         error("no icode file specified");
  113.      /*
  114. --- 273,276 -----
  115.         error("no icode file specified");
  116. + #endif        /* ATARI_ST */
  117. +    }
  118.      /*
  119. **************
  120. *** 610,612
  121.   #endif                    /* TallyOpt */
  122.         /*
  123. --- 617,623 -----
  124.   #endif                    /* TallyOpt */
  125. ! #if ATARI_ST
  126. !     case 't':
  127. !         k_trace = -1;
  128. !         break;
  129. ! #endif                    /* ATARI_ST */
  130.         /*
  131. **************
  132. *** 657,659
  133.   
  134. ! #if ATARI_ST || MSDOS || OS2 || VMS
  135.                  dup2(fileno(stdout),fileno(stderr));
  136. --- 668,673 -----
  137.   
  138. ! #if ATARI_ST
  139. ! #ifdef __GNUC__
  140. !            ST_error("redirection of stderr to stdout not supported");
  141. ! #else
  142.                  dup2(fileno(stdout),fileno(stderr));
  143. **************
  144. *** 659,661
  145.                  dup2(fileno(stdout),fileno(stderr));
  146. ! #endif                    /* ATARI_ST || MSDOS || OS2 ... */
  147.   
  148. --- 673,679 -----
  149.                  dup2(fileno(stdout),fileno(stderr));
  150. ! #endif
  151. ! #endif                    /* ATARI_ST */
  152. ! #if MSDOS || OS2 || VMS
  153. !                dup2(fileno(stdout),fileno(stderr));
  154. ! #endif                    /* MSDOS || OS2 ... */
  155.   
  156. **************
  157. *** 721,722
  158.      extern struct astkblk *alcactiv();
  159.   
  160. --- 739,743 -----
  161.      extern struct astkblk *alcactiv();
  162. + #if ATARI_ST
  163. +    int trace_flag = k_trace;
  164. + #endif                    /* ATARI_ST */
  165.   
  166. **************
  167. *** 831,832
  168.      datainit();
  169.   
  170. --- 852,857 -----
  171.      datainit();
  172. + #if ATARI_ST
  173. +    if (-1 == trace_flag)
  174. +       k_trace = trace_flag;
  175. + #endif                    /* ATARI_ST */
  176.   
  177. **************
  178. *** 837,838
  179.      if (!name)
  180.         error("no interpreter file supplied");
  181. --- 862,866 -----
  182.      if (!name)
  183. + #if ATARI_ST
  184. +       ST_error("no interpreter file supplied");
  185. + #else
  186.         error("no interpreter file supplied");
  187. **************
  188. *** 838,840
  189.         error("no interpreter file supplied");
  190.      /*
  191. --- 866,868 -----
  192.         error("no interpreter file supplied");
  193. ! #endif
  194.      /*
  195. **************
  196. *** 900,902
  197.   
  198.      k_trace = hdr.trace;
  199. --- 928,932 -----
  200.   
  201. ! #if ATARI_ST
  202. !    if (-1 != k_trace)
  203. ! #endif                    /* ATARI_ST */
  204.      k_trace = hdr.trace;
  205. **************
  206. *** 1363,1364
  207.   
  208.   /*
  209. --- 1393,1400 -----
  210.   
  211. + hidden novalue ST_error(s)
  212. + char *s;
  213. +    {
  214. +    fprintf(stderr, "usage: iconx %s\n", Usage);
  215. +    error(s);
  216. +    }
  217.   /*
  218. *** old\makefile
  219. --- makefile
  220. **************
  221. *** 0,0
  222. --- 1,158 -----
  223. + CC=gcc
  224. + CFLAGS=-O -fstrength-reduce -fcombine-regs -fomit-frame-pointer
  225. + LFLAGS=-x
  226. + OBJS= extcall.o fconv.o fmath.o fmemmon.o fmisc.o fscan.o fstr.o fstranl.o \
  227. +     fstruct.o fsys.o fxtra.o idata.o imain.o interp.o invoke.o lmisc.o \
  228. +     lrec.o lscan.o oarith.o oasgn.o ocat.o ocomp.o omisc.o oref.o oset.o \
  229. +     ovalue.o rcomp.o rconv.o rdebug.o rdefault.o rlargint.o rdoasgn.o \
  230. +     rlocal.o rmemmgt.o rmisc.o rstruct.o rsys.o rswitch.o
  231. + COBJS= ..\common\long.o ..\common\memory.o ..\common\time.o
  232. + LIBS=-lpml
  233. + PGM=iconx.ttp
  234. + all: $(PGM)
  235. + $(PGM): $(OBJS) $(COBJS)
  236. +     $(CC) $(CFLAGS) -o $(PGM) $(OBJS) $(COBJS) $(LIBS) $(LFLAGS)
  237. +     toglclr $(PGM) # for TOS 1.4
  238. + clean:
  239. +     $(RM) $(OBJS)
  240. + ####
  241. + extcall.o : extcall.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  242. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  243. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  244. + fconv.o : fconv.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  245. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  246. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  247. + fmath.o : fmath.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  248. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  249. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  250. + fmemmon.o : fmemmon.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  251. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  252. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  253. + fmisc.o : fmisc.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  254. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  255. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  256. + fscan.o : fscan.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  257. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  258. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  259. + fstr.o : fstr.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  260. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  261. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  262. + fstranl.o : fstranl.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  263. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  264. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  265. + fstruct.o : fstruct.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  266. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  267. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  268. + fsys.o : fsys.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  269. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  270. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  271. + fxtra.o : fxtra.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  272. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  273. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  274. + idata.o : idata.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  275. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  276. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  277. + imain.o : imain.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  278. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  279. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h ..\h\version.h \
  280. +   ..\h\header.h ..\h\opdefs.h 
  281. + interp.o : interp.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  282. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  283. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h ..\h\opdefs.h 
  284. + invoke.o : invoke.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  285. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  286. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  287. + istart.o : istart.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  288. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  289. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  290. + lmisc.o : lmisc.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  291. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  292. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h ..\h\keyword.h \
  293. +   ..\h\version.h 
  294. + lrec.o : lrec.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  295. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  296. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  297. + lscan.o : lscan.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  298. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  299. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  300. + oarith.o : oarith.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  301. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  302. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  303. + oasgn.o : oasgn.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  304. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  305. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  306. + ocat.o : ocat.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  307. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  308. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  309. + ocomp.o : ocomp.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  310. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  311. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  312. + omisc.o : omisc.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  313. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  314. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  315. + oref.o : oref.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  316. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  317. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  318. + oset.o : oset.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  319. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  320. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  321. + ovalue.o : ovalue.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  322. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  323. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  324. + rcomp.o : rcomp.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  325. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  326. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  327. + rconv.o : rconv.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  328. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  329. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  330. + rdebug.o : rdebug.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  331. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  332. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h ..\h\opdefs.h 
  333. + rdefault.o : rdefault.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  334. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  335. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  336. + rdoasgn.o : rdoasgn.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  337. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  338. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  339. + rlargint.o : rlargint.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  340. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  341. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  342. + rlocal.o : rlocal.c getch.c system.c ..\h\config.h ..\h\define.h \
  343. +    ..\h\proto.h ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  344. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h
  345. + rmemmgt.o : rmemmgt.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  346. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  347. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h rmemexp.c 
  348. + rmisc.o : rmisc.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  349. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  350. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  351. + rstruct.o : rstruct.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  352. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  353. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  354. + rswitch.o : rswitch.s
  355. + rsys.o : rsys.c ..\h\config.h ..\h\define.h ..\h\proto.h \
  356. +   ..\common\cproto.h ..\h\rt.h ..\h\cpuconf.h \
  357. +   ..\h\memsize.h rproto.h ..\h\fdefs.h ..\h\odefs.h 
  358. + #
  359. + ..\common\long.o : ..\common\long.c ..\h\config.h \
  360. +   ..\h\define.h ..\h\proto.h ..\common\cproto.h ..\h\cpuconf.h 
  361. +     pushd ..\common
  362. +     make long.o
  363. +     popd
  364. + ..\common\memory.o : ..\common\memory.c ..\h\config.h \
  365. +   ..\h\define.h ..\h\proto.h ..\common\cproto.h 
  366. +     pushd ..\common
  367. +     make memory.o
  368. +     popd
  369. + ..\common\time.o : ..\common\time.c ..\h\config.h \
  370. +   ..\h\define.h ..\h\proto.h ..\common\cproto.h 
  371. +     pushd ..\common
  372. +     make time.o
  373. +     popd
  374. *** old\rconv.c
  375. --- rconv.c
  376. **************
  377. *** 554,555
  378.   #if AMIGA || ATARI_ST || MSDOS || UNIX || VMS
  379.      gcvt(n, Precision, s);
  380. --- 554,561 -----
  381.   #if AMIGA || ATARI_ST || MSDOS || UNIX || VMS
  382. + #ifdef __GNUC__
  383. +    (void)sprintf(s,"%.*g", Precision, n);
  384. +    if (('-' == *s) && ('0' == s[1])) {
  385. +     (void)memcpy(s + 1, s + 2, strlen(s + 1));  /* add one for '\0' */
  386. +    }
  387. + #else
  388.      gcvt(n, Precision, s);
  389. **************
  390. *** 555,556
  391.      gcvt(n, Precision, s);
  392.   #endif                                  /* AMIGA  || ATARI_ST || ... */
  393. --- 561,563 -----
  394.      gcvt(n, Precision, s);
  395. + #endif
  396.   #endif                                  /* AMIGA  || ATARI_ST || ... */
  397. *** old\rlocal.c
  398. --- rlocal.c
  399. **************
  400. *** 101,102
  401.   
  402.   long _STACK = 10240;
  403. --- 101,108 -----
  404.   
  405. + #ifdef __GNUC__
  406. + #include <osbind.h>
  407. + extern long _initial_stack = 3L; /* grab 3/4 of available memory */
  408. + #include "getch.c"
  409. + #include "system.c"
  410. + #else
  411.   long _STACK = 10240;
  412. **************
  413. *** 135,136
  414.   }
  415.   
  416. --- 141,143 -----
  417.   }
  418. + #endif
  419.   
  420. **************
  421. *** 136,138
  422.   
  423.   weekday(day,month,year)   /* find day of week from    */
  424. --- 143,144 -----
  425.   
  426.   weekday(day,month,year)   /* find day of week from    */
  427. **************
  428. *** 155,156
  429.   
  430.   time(ptime)   /* return value of millisecond timer */
  431. --- 161,165 -----
  432.   
  433. + #ifdef __GNUC__
  434. + atime(ptime)   /* return value of millisecond timer */
  435. + #else
  436.   time(ptime)   /* return value of millisecond timer */
  437. **************
  438. *** 156,157
  439.   time(ptime)   /* return value of millisecond timer */
  440.   int  *ptime;
  441. --- 165,167 -----
  442.   time(ptime)   /* return value of millisecond timer */
  443. + #endif
  444.   int  *ptime;
  445. **************
  446. *** 161,162
  447.   
  448.     ssp = gemdos(0x20,0);   /* enter supervisor mode */
  449. --- 171,176 -----
  450.   
  451. + #ifdef __GNUC__
  452. +   ssp = Super(0L);        /* enter supervisor mode */
  453. + #else
  454.     ssp = gemdos(0x20,0);   /* enter supervisor mode */
  455. **************
  456. *** 162,163
  457.     ssp = gemdos(0x20,0);   /* enter supervisor mode */
  458.     tmp = *tmr * 5;         /* get millisecond timer */
  459. --- 176,178 -----
  460.     ssp = gemdos(0x20,0);   /* enter supervisor mode */
  461. + #endif
  462.     tmp = *tmr * 5;         /* get millisecond timer */
  463. **************
  464. *** 163,164
  465.     tmp = *tmr * 5;         /* get millisecond timer */
  466.     ssp = gemdos(0x20,ssp); /* enter programmer mode */
  467. --- 178,182 -----
  468.     tmp = *tmr * 5;         /* get millisecond timer */
  469. + #ifdef __GNUC__
  470. +   ssp = Super(ssp);       /* enter programmer mode */
  471. + #else
  472.     ssp = gemdos(0x20,ssp); /* enter programmer mode */
  473. **************
  474. *** 164,166
  475.     ssp = gemdos(0x20,ssp); /* enter programmer mode */
  476.     if(ptime != NULL)
  477. --- 182,184 -----
  478.     ssp = gemdos(0x20,ssp); /* enter programmer mode */
  479. ! #endif
  480.     if(ptime != NULL)
  481. **************
  482. *** 180,181
  483.   
  484.     return((lsbrk((long) (l - m)) == 0) ? -1 : 0);
  485. --- 198,202 -----
  486.   
  487. + #ifdef __GNUC__
  488. +   return(-(lsbrk((long) (l - m)) == -1L));
  489. + #else
  490.     return((lsbrk((long) (l - m)) == 0) ? -1 : 0);
  491. **************
  492. *** 181,182
  493.     return((lsbrk((long) (l - m)) == 0) ? -1 : 0);
  494.   }
  495. --- 202,204 -----
  496.     return((lsbrk((long) (l - m)) == 0) ? -1 : 0);
  497. + #endif
  498.   }
  499. *** old\rswitch.s
  500. --- rswitch.s
  501. **************
  502. *** 0,0
  503. --- 1,57 -----
  504. + |-------------------------------------------------------------------------
  505. + |   Context switch for Atari ST Icon
  506. + |-------------------------------------------------------------------------
  507. + |
  508. + |                ========   SP (a7) ->  |-------------------| Low
  509. + |                expression evaluation  |    temporaries    |
  510. + |                                       |-------------------|
  511. + |                addressed as negative  |  auto data items  |
  512. + |                      offsets from FP  |     .  .  .       |
  513. + |                ========   FP (a6) ->  |-------------------|
  514. + |                called routine pushes  | caller's saved FP |
  515. + |                                       |-------------------|
  516. + |                pushed by jsr          |  return address   |
  517. + |                                       |-------------------|
  518. + |                first argument is      |    arguments      |
  519. + |                a6 plus 8 bytes        |     .  .  .       |
  520. + |                old SP value   ----->  |-------------------| High
  521. + |
  522. + |-------------------------------------------------------------------------
  523. +         .text                | control section for instructions
  524. +         .globl    _coswitch
  525. +         .globl    _interp
  526. +         .globl    _syserr
  527. + |   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
  528. + _coswitch:
  529. +         link    a6,#0           | push frame pointer & allocate no locals
  530. +         movel   a6@(8),a0       | a0 = address of old_cs
  531. +         movel   a6@(12),a1       | a1 = address of new_cs
  532. +         movel   a7,a0@           | store stack pointer in old_cs
  533. +         moveml  d2-d7/a2-a6,a0@(4) | store needed registers in old_cs
  534. +         movel   a1@,a7           | load stack pointer from new_cs
  535. +         tstl    a6@(16)           | if(first == 0) {
  536. +         bne     nofirst
  537. +         moveq   #0,d0           | zero return value
  538. +         movel   d0,a6           | zero frame pointer
  539. +         movel   d0,sp@-           | push two zero arguments
  540. +         movel   d0,sp@-           | for interp()
  541. +         jsr     _interp           | call interp()
  542. +         addql   #8,a7           | remove interp() args from stack
  543. +         pea     mesg           | push argument for syserr()
  544. +         jsr     _syserr           | call syserr()
  545. + |   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
  546. + |  Following instructions not needed because syserr() never returns         *
  547. + |                                                                           *
  548. + |       addql   #4,a7           | remove syserr() args from stack    *
  549. + |       bra     done                 } else                                 *
  550. + |   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
  551. + nofirst:
  552. +         moveml  a1@(4),d2-d7/a2-a6  | restore preserved regs from new_cs
  553. + |   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
  554. + done:
  555. +         unlk    a6           | restore frame pointer from stack
  556. +         rts               | return to calling program
  557. + |   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *   *
  558. +         .data               | control section for initialized statics
  559. + mesg:   .asciz    "interp() returned in coswitch"
  560. *** old\system.c
  561. --- system.c
  562. **************
  563. *** 0,0
  564. --- 1,106 -----
  565. + #include <osbind.h>
  566. + #include <stdio.h>
  567. + #include <string.h>
  568. + #include <basepage.h>
  569. + #ifdef __GNUC__
  570. + #include <process.h>
  571. + #define ERROR 2
  572. + #endif
  573. + /**  #define DEBUG  **/
  574. + #ifdef DEBUG
  575. + #define _COOKIE(x) puts(x);putchar('\n')
  576. + #endif
  577. + static parse_args(cmdln, argv)
  578. +     char *cmdln;
  579. +     register char *argv[];
  580. +     {
  581. +     register char *p;
  582. +     static char delim[] = " \t\r\n";
  583. +     if(p = strtok(cmdln, delim))
  584. +         {
  585. +         do
  586. +             {
  587. +             *argv++ = p;
  588. +             }
  589. +             while(p = strtok(NULL, delim));
  590. +         }
  591. +     }
  592. + #ifdef __GNUC__
  593. + static volatile long savearea[15];
  594. + #endif
  595. + int system(command)
  596. +     register char *command;
  597. +     {
  598. +     register char *p;
  599. +     register int (*shell)();
  600. +     char rv[2];
  601. +     char cmdln[1024];
  602. +     char *args[64];
  603. +     char *getenv();
  604. +     if(!command)
  605. +         return(ERROR);
  606. +     /* get _shell_p value */
  607. +     p = (char *) Super(0L);
  608. +     shell = (int (*)()) *((long *) 0x4F6L);
  609. +     Super(p);
  610. +     /* validate _shell_p */
  611. +     if((shell) &&                /* Shell available. */
  612. +        (((long) shell) < ((long) _base)) &&    /* Reasonable shell pointer. */
  613. +        (strncmp((char *)shell, "PATH", 4)))    /* Not corrupted */
  614. +         {
  615. + #ifdef __GNUC__
  616. +         int ret;
  617. + #endif
  618. +         /* execute the command */
  619. + #ifdef DEBUG
  620. + _COOKIE("system: using _shell_p");
  621. + printf("'shell' got value 0x%08lx\n", (long)shell);
  622. + #endif
  623. + /* a bit of paranoia caused by some misbehaving programs */
  624. + #ifdef __GNUC__
  625. + asm("moveml d1-d7/a0-a7,_savearea");    
  626. +         ret = (*shell)(command);
  627. + asm("moveml _savearea,d1-d7/a0-a7");
  628. +         return (ret);
  629. + #else
  630. +         return ((*shell)(command));
  631. + #endif
  632. +         }
  633. +     strcpy(cmdln, command);    /* copy the command line for parsing */
  634. +     if((p = getenv("SHELL")) && (*p))    /* SHELL= variable? */
  635. +         {
  636. +         args[0] = p;
  637. +         parse_args(cmdln, (args + 1));
  638. + #ifdef DEBUG
  639. + _COOKIE("system: executing SHELL");
  640. + _COOKIE(p);
  641. + #endif
  642. +         }
  643. +     else    /* attempt to find first token as a program on the path */
  644. +         {
  645. +         parse_args(cmdln, args);
  646. +         p = args[0];
  647. + #ifdef DEBUG
  648. + _COOKIE("system: directly executing program");
  649. + _COOKIE(p);
  650. + #endif
  651. +         }
  652. + #ifdef __GNUC__
  653. +     return spawnvp(0, p, args);
  654. + #else
  655. +     forkvpe(p, args, NULL);
  656. +     wait(rv);
  657. +     return((rv[1] == 0) ? rv[0] : rv[1]);
  658. + #endif
  659. +     }
  660.